home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Hardware tools / TV-Man / With Source Version / Includes / TV-Man.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  9.5 KB  |  322 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    TV-Man.h
  4. #
  5. #    Copyright © Apple Computer, Inc. 1989-1990
  6. #    All rights reserved.
  7. #
  8. #
  9. #
  10. #
  11. #    This is the file that is common to all sources and resources. It contains all the 
  12. #    constants which can be acted upon locally.
  13. #
  14. #    In order to have an evironment which predictable events happen several definitions
  15. #    must be established. The most critical is in the file architecture. Each functional
  16. #    block will have its own source and header file. The main project file,  in this
  17. #    case TV-Man, will have its header file included with all other files. This will
  18. #    allow for global constants. The utility source file shall contain functions that
  19. #    are general purpose in nature and that can be used by all other functions. These
  20. #    are intended not to be application or major block specific. In order for this to be 
  21. #    accomodated all functions in the utility source file must use only the information
  22. #    that is passed to them or information that can be gleaned from the system via
  23. #    toolbox calls. There will be no header file associated with the utility file as this
  24. #    will destroy the intent of the utilities.
  25. #
  26. #    There are several files which contain information which is global in nature .These
  27. #    file are included in the main project header file. They are: x.Errors.h, x.Ext.h,
  28. #    x.Protos.h, x.Menus.h. The reason for containing them in seperate files is one of
  29. #    convienience and accesability. 
  30. #
  31. #
  32. #    Revision Log:
  33. #    
  34. #        4-26-91        RGK        Creation
  35. #
  36. #
  37. ------------------------------------------------------------------------------*/
  38.  
  39. /*----------------------------------------------------------------------------*/
  40. /*    We made the preferred size bigger than the minimum size by 12K, so that
  41.     there would be even more room for the scrap, FKEYs, etc. */
  42.  
  43. #define kMinSize                50        /* application's minimum size (in K) */
  44. #define kPrefSize                75        /* application's preferred size (in K) */
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. /*----------------------------------------------------------------------------*/
  52. /* kSysEnvironsVersion is passed to SysEnvirons to tell it which version of the
  53.    SysEnvRec we understand. */
  54.  
  55. #define    kSysEnvironsVersion        1
  56.  
  57.  
  58.  
  59.  
  60.  
  61. /*----------------------------------------------------------------------------*/
  62. /*    kTopLeft - This is for positioning the Disk Initialization dialogs. */
  63.  
  64. #define kDITop                    0x0050
  65. #define kDILeft                    0x0070
  66.  
  67.  
  68.  
  69.  
  70.  
  71. /*----------------------------------------------------------------------------*/
  72. /*    kMinHeap - This is the minimum result from the following
  73.     equation:
  74.         
  75.         ORD(GetApplLimit) - ORD(ApplicZone)
  76.         
  77.     for the application to run. It will insure that enough memory will
  78.     be around for reasonable-sized scraps, FKEYs, etc. to exist with the
  79.     application, and still give the application some 'breathing room'.
  80.     To derive this number, we ran under a MultiFinder partition that was
  81.     our requested minmum size, as given in the 'SIZE' resource. */
  82.      
  83. #define kMinHeap                45 * 1024
  84.  
  85.  
  86.  
  87.  
  88.     
  89. /*----------------------------------------------------------------------------*/
  90. /*    kMinSpace - This is the minimum result from PurgeSpace, when called
  91.     at initialization time, for the application to run. This number acts
  92.     as a double-check to insure that there really is enough memory for the
  93.     application to run, including what has been taken up already by
  94.     pre-loaded resources, the scrap, code, and other sundry memory blocks. */
  95.      
  96. #define kMinSpace                15 * 1024
  97.  
  98.  
  99.  
  100.  
  101.  
  102. /*----------------------------------------------------------------------------*/
  103. /* kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
  104.  
  105. #define kExtremeNeg                -32768
  106. #define kExtremePos                32767 - 1 /* required to address an old region bug */
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113. /*----------------------------------------------------------------------------*/
  114. /* kOSEvent is the event number of the suspend/resume and mouse-moved events sent
  115.    by MultiFinder. Once we determine that an event is an osEvent, we look at the
  116.    high byte of the message sent to determine which kind it is. To differentiate
  117.    suspend and resume events we check the resumeMask bit. */
  118.  
  119. #define    kOSEvent                app4Evt    /* event used by MultiFinder */
  120. #define    kSuspendResumeMessage    1        /* high byte of suspend/resume event message */
  121. #define    kResumeMask                1        /* bit of message field for resume vs. suspend */
  122. #define    kMouseMovedMessage        0xFA    /* high byte of mouse-moved event message */
  123. #define    kNoEvents                0        /* no events mask */
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. /*----------------------------------------------------------------------------*/
  131. /* Define HiWrd and LoWrd macros for efficiency. */
  132.  
  133. #define HiWrd(aLong)    (((aLong) >> 16) & 0xFFFF)
  134. #define LoWrd(aLong)    ((aLong) & 0xFFFF)
  135.  
  136.  
  137.  
  138.  
  139.  
  140. /*----------------------------------------------------------------------------*/
  141. /* Define TopLeft and BotRight macros for convenience. Notice the implicit
  142.    dependency on the ordering of fields within a Rect */
  143.  
  144. #define TopLeft(aRect)    (* (Point *) &(aRect).top)
  145. #define BotRight(aRect)    (* (Point *) &(aRect).bottom)
  146.  
  147.  
  148.  
  149.  
  150.  
  151. /*----------------------------------------------------------------------------*/
  152. /*    Misc Resource ID base numbers. The functional blocks will have resource
  153.     Id numbers based opon these values. This is a effort to group resources of
  154.     like types by function.    */
  155.  
  156. #define rDfltId            200
  157. #define rMainApp        (rDfltId)        /* Main application resource root    */
  158. #define rErrors            (rDfltId + 1)    /* Error data resource root            */
  159. #define rVideo            (rDfltId + 2)    /* video resource root                */
  160. #define    rSounds            (rDfltId + 3)    /* Sound Dialog resource root        */
  161.  
  162.  
  163.  
  164.  
  165. /*----------------------------------------------------------------------------*/
  166. /*    The above resource numbers will be used in calculations in the various
  167.     header files to give logical groupings to resource numbers. The following
  168.     resources are here because it is part of the main application block and
  169.     will serve as a simple example.    */
  170.  
  171. #define rMenu            (rMainApp * 10)            /* applications menu bar    */
  172. #define    rWindow            (rMainApp * 10) + 1        /* application's window     */
  173. #define    rIcon            (rMainApp * 10) + 2        /* this applications Icon     */
  174. #define    rFref            (rMainApp * 10) + 3        /* Fref resource             */
  175. #define    rAboutAlert        (rMainApp * 10) + 4        /* about alert box             */
  176.  
  177.  
  178.  
  179.  
  180. /*----------------------------------------------------------------------------*/
  181. /*    Misc.Keyboard constants.        */
  182.  
  183. #define ENTERKEY    3
  184. #define RETURNKEY    13
  185.  
  186.  
  187.  
  188.  
  189.  
  190. /*----------------------------------------------------------------------------*/
  191. /*    if this program is to be run on a machine with system seven set the following
  192.     definition to be true    */
  193.  
  194. #define SystemSevenOrLater true
  195.  
  196.  
  197.  
  198.  
  199.  
  200. /*----------------------------------------------------------------------------*/
  201. /*----------------------------------------------------------------------------*/
  202. /*    The following line will effectivly eliminate the following typedefs from the 
  203.     this header file during the Rez process because Rez cannot handle typedefs.
  204.     All Resource files will define "__Rezing__" when processing, all C sources
  205.     will not    */
  206.     
  207. #ifndef __Rezing__
  208.  
  209.  
  210.  
  211.  
  212. /*----------------------------------------------------------------------------*/
  213. /* This is a list of all the necessary ToolBox include files.    */
  214.  
  215. #include <Memory.h>
  216. #include <OSEvents.h>
  217. #include <DiskInit.h>
  218. #include <ToolUtils.h>
  219. #include <Values.h>
  220. #include <Desk.h>
  221. #include <Resources.h>
  222. #include <Dialogs.h>
  223. #include <Traps.h>
  224. #include <Menus.h>
  225. #include <Palette.h>
  226. #include <Packages.h>
  227. #include <Fonts.h>
  228. #include <Sound.h>
  229.  
  230.  
  231.  
  232.  
  233. /*    These are the other avaliable ToolBox includes here for convienance, cut and
  234.     paste to above list to use    */
  235.     
  236. /*
  237. #include <OSUtils.h>
  238. #include <Files.h>
  239. #include <SegLoad.h>
  240. #include <TextEdit.h>
  241. #include <QuickDraw.h>
  242. #include <Types.h>
  243. #include <Windows.h>
  244. #include <Events.h>
  245. */
  246.  
  247.  
  248.  
  249.  
  250.  
  251. #ifndef __Beep__    /* test to see if the Beep structure has already been defined    */
  252. #define    __Beep__            
  253.  
  254. /*----------------------------------------------------------------------------*/
  255. /*    This is the resource structure for the beep data. Since it is used in TV-Man 
  256.     as a global it is defined in the TV-Man.h file. This allows everyone to see
  257.     it. The ifdef switch is used to limit the number of the Beep structures that 
  258.     the compilier will try to use. This structure resides here because it is part
  259.     of the sound system and if removed from TV-Man it will have to leave with it. */
  260.     
  261. typedef struct Beep
  262. {
  263.     short            Enabled;
  264.     short            Type;
  265.     short            Length;
  266.     short            QTime;
  267.     short            Count;
  268.     short            Delay;
  269.     short            Volume;
  270.     short            Freq;
  271.     short            Init;            /* the sound channel init id        */
  272.     short            RsrcId;            /* the resource id                    */
  273.     Str32            Title;
  274. } Beep, *BeepPtr, **BeepHdl;
  275.  
  276.  
  277.  
  278. /*----------------------------------------------------------------------------*/
  279. /*    This Structure is used to hold the global varables which make a "Beep
  280.     Channel".    */
  281.     
  282. typedef struct BeepChan
  283. {
  284.     Boolean            Error;            /* true if any sound setup errored    */
  285.     Boolean            InProcess;        /* true if any sound setup errored    */
  286.     short            RsrcId;            /* the resource id                    */
  287.     SndChannelPtr    SndChannel;        /* Pointer to the 1st sound channel    */
  288. } BeepChan, *BeepCPtr, **BeepCHdl;
  289.  
  290.  
  291.  
  292.  
  293. #endif __Beep__
  294.  
  295.  
  296.  
  297.  
  298. /*    These are all the "local" includes necessary in a global concept    */
  299.  
  300. #include "TV-Man.Ext.h"
  301. #include "TV-Man.Menus.h"
  302. #include "TV-Man.Errors.h"
  303. #include "TV-Man.Protos.h"
  304.  
  305.  
  306.  
  307. /*    The next command identifies the rest of the IF statement as only used during Rezing    */
  308. #else
  309.  
  310. /* the following should have been in "SysTypes.r" but aren't    */
  311.  
  312. #define initChan0    0x0004        /* channel 0 - wave table only */
  313. #define initChan1    0x0005        /* channel 1 - wave table only */
  314. #define initChan2    0x0006        /* channel 2 - wave table only */
  315. #define initChan3    0x0007        /* channel 3 - wave table only */
  316.  
  317.  
  318.  
  319.  
  320. #endif __Rezing__
  321.  
  322.